package com.dlc.shop.combo.api.controller;

import com.dlc.shop.bean.vo.GiveawayVO;
import com.dlc.shop.combo.multishop.service.GiveawayService;
import com.dlc.shop.common.response.ServerResponseEntity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Citrus
 * @date 2021/11/12 9:19
 */
@RestController
@RequestMapping("/p/giveaway" )
@Tag(name = "用户端赠品接口")
@AllArgsConstructor
public class GiveawayController {

    private final GiveawayService giveawayService;


    @GetMapping("/info/{prodId}")
    @Operation(summary = "通过商品id查询赠品信息" , description = "通过商品id查询赠品")
    public ServerResponseEntity<GiveawayVO> getById(@PathVariable("prodId") Long prodId) {
        GiveawayVO giveawayVO = giveawayService.getGiveawayProdByProdId(prodId);
        return ServerResponseEntity.success(giveawayVO);
    }
}
